package com.aipolice.service;

import com.aipolice.dao.ReportDAO;
import com.aipolice.pojo.Report;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReportService {
    @Autowired
    ReportDAO reportDAO;

    public List<Report> list(){
        return reportDAO.findAll();
    }

    public Report add(Report report){
        reportDAO.save(report);
        return  report;
    }

    public void delete(int id){
        reportDAO.deleteById(id);
    }

    public Report find(int id){
        return  reportDAO.findById(id).get();
    }
}
